#include "process.h"
#include <string.h>

#define style '#'
#define size 101

void Flushprocess(double total,double current)
{
    const char* lable = "|/-\\";
    int len = strlen(lable);

    double rate = current*100.0/total;
    int num = (int)rate;
    char buffer[size];
    memset(buffer,0,sizeof(buffer));

    int i = 0;
    for(i; i < num; i++)
    {
        buffer[i] = style;
    }
    printf("[%-100s][%.1f\%][%c]\r",buffer,rate,lable[num%len]);
    fflush(stdout);
}
